package demo.springcloud.consumers.controller;

import demo.springcloud.consumers.inter.HomeRemote;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@Slf4j
public class HomeController {
    @Autowired
    private HomeRemote homeRemote;

    @GetMapping("/test")
    public String test(HttpServletRequest request){
        log.error("---------------------------    313333333333   ----------------------------------");
        log.info(" \n  TraceId={} \n  SpanId={} \n  ParentSpanId={} \n  Sampled={} \n  Name={}"
                , request.getHeader("X-B3-TraceId")
                , request.getHeader("X-B3-SpanId")
                , request.getHeader("X-B3-ParentSpanId")
                , request.getHeader("X-B3-Sampled")
                , request.getHeader("X-Span-Name"));

        return homeRemote.index();
    }
}
